<template>
	<view class="page">
		<view class="page-header">
			<view class="page-header-content">
				<view class="page-header-title">筛选</view>
			</view>
		</view>
		<view class="page-body form">
			<view class="form-group">
				<view class="form-item">
					<view class="form-item-header">任务号：</view>
					<view class="form-item-body">
						<input 
							v-model="eventTaskNo"
							class="form-control" 
							placeholder="请输入任务号" />
					</view>
				</view>
				<view class="form-item">
					<view class="form-item-header">案卷描述：</view>
					<view class="form-item-body">
						<input 
							class="form-control" 
							v-model="eventDescribe" 
							placeholder="请输入案卷描述" />
					</view>
				</view>
				<view class="form-item">
					<view class="form-item-header">请选择时间：</view>
					<view class="form-item-body">
						<view class="cals">
							<view class="cals-group">
								<view class="cals-item">
									<picker mode="date" class="picker" @change="bindBeginDateChange">
										<view class="cals-item-content">{{ startTime || '开始时间' }}</view>
										<image class="icon" src="@/static/icon/iv_calendar2.png"></image>
									</picker>
								</view>
								<view class="cals-item">
									<picker mode="date" class="picker" @change="bindEndDateChange">
										<view class="cals-item-content">{{ endTime || '结束时间' }}</view>
										<image class="icon" src="@/static/icon/iv_calendar2.png"></image>
									</picker>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="page-footer btns fix-bottom">
			<view class="btns-group">
				<view class="btns-item">
					<button class="btn btn-a" @tap="bindReset">重置</button>
				</view>
				<view class="btns-item" @tap="bindSubmit">
					<button class="btn btn-b">查找</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { querySzbmJsdBusinessMiddle, querySzbmJsdBusiness, queryMiddleJsdList } from '@/api/configure.js';
import { deepClone ,mergeUrls, getUserInfo, formatDateStr } from '@/util/util.js';
import { pathToBase64, base64ToPath } from '@/util/mmmm-image-tools/index.js';
import configUrl from '@/util/url.js';

export default {
	props: {
		data: {
			type: Object,
			default: ()=>{
				return {}
			}
		}
	},
	data(){
		return {
			eventTaskNo   : '', //任务号
			eventDescribe : '', //案卷描述
			startTime     : '', //开始时间
			endTime       : '', //结束时间 
		}
	},
	methods: {
		bindBeginDateChange(e) {
			this.startTime = e.detail.value ;
		},
		bindEndDateChange(e) {
			this.endTime = e.detail.value ;
		},
		bindReset() {
			this.eventTaskNo = '';
			this.eventDescribe = '';
			this.startTime = '';
			this.endTime = '';
		},
		bindSubmit() {
			let data = {
				eventTaskNo: this.eventTaskNo,
				eventDescribe: this.eventDescribe,
				startTime: this.startTime,
				endTime: this.endTime
			}
			
			this.$emit('sendCondition', data);
		},
		getData() {
			Object.keys(this.data).forEach((key) => {
				this.$data[key] = this.data[key];
			})
		},
		init() {
			this.getData();
		}
	},
	created() {
		this.init();
	},
	mounted() {}
}
</script>

<style lang="scss">
	.page{
		.page-header{
			padding-top: var(--status-bar-height);
			height: 44px;
			background-color: #f29004;
		}
		.page-header-content{
			position: absolute;
			top: var(--status-bar-height);
			left: 0px;
			right: 0px;
			height: 44px;
			background-color: #f29004;
			.page-header-title{
				padding: 13px;
				font-size: 16px;
				line-height: 120%;
				color: #fff;
				text-align: center;
				font-weight: bold;
			}
		}
	}
	
	.form{
		.form-group{
			.form-item{
				.form-item-header{
					padding: 12rpx 20rpx 12rpx;
					font-size: 24rpx;
					line-height: 120%;
					color: #5d5d5d;
				}
				.form-item-body{
					padding: 0rpx 20rpx;
					.form-control{
						padding: 16rpx 16rpx;
						font-size: 24rpx;
						line-height: 120%;
						color: #5d5d5d;
						border: 1rpx solid #f29004;
						border-radius: 10rpx;
					}
				}
			}
		}
	}
	
	.cals{
		.cals-group{
			display: flex;
			justify-content: space-between;
			position: relative;
			top: 0rpx;
			left: 0rpx;
			&:after{
				margin-left: -10rpx;
				position: absolute;
				left: 50%;
				top: 50%;
				width: 20rpx;
				height: 1rpx;
				content: '';
				background-color: #c4c4c4;
			}
			.picker{
				width: 100%;
				padding: 16rpx 30rpx 16rpx 10rpx;
				box-sizing: border-box;
			}
			.cals-item{
				width: 180rpx;
				border: 1rpx solid #c4c4c4;
				border-radius: 10rpx;
				position: relative;
				top: 0rpx;
				left: 0rpx;
				box-sizing: border-box;
				.cals-item-content{
					height: 28rpx;
					font-size: 24rpx;
					line-height: 120%;
					color: #5d5d5d;
					text-align: center;
				}
				.icon{
					margin-top: -15rpx;
					margin-left: 58rpx;
					position: absolute;
					top: 50%;
					left: 50%;
					width: 26rpx;
					height: 26rpx;
				}
			}
		}
		
	}
	
	.btns{
		background-color: #ffffff;
		.btns-group{
			padding: 17rpx 0rpx;
			display: flex;
			.btns-item{
				width: 50%;
			}
		}
	}
	
	.btn{
		padding: 16rpx 0px;
		font-size: 24rpx;
		line-height: 120%;
		color: #fff;
		text-align: center;
		border: none;
		border-radius: 0rpx;
		background: none;
		&:after{
			display: none;
		}
		&.btn-a{
			background-color: #ffebe1;
			color: #f29004;
		}
		&.btn-b{
			background-color: #f29004;
		}
	}
	
	.fix-bottom{
		position: fixed;
		bottom: 0rpx;
		left: 0rpx;
		right: 0rpx;
	}
</style>
